<?php
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/art-dialog/jquery.artDialog.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/art-dialog/plugins/iframeTools.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery-ui-1.8.11.custom.min.js",CClientScript::POS_HEAD);
?>
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/css/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/js/art-dialog/skins/blue.css" />
    <!-- page title -->
    <div class="page-title" style="z-index: 780;">
        <div class="in" style="z-index: 770;">
            <div class="titlebar" style="z-index: 760;">	<h2 class="title">dudu券管理</h2></div>

            <div class="clear" style="z-index: 740;"></div>
        </div>
    </div>
    <style>
        .grid-view {
            padding: 0;
        }
        table.tablesorters {
            background-color: #CDCDCD;
            font-family: arial;
            font-size: 12px;
            margin: 0 0;
            text-align: left;
            width: 100%;
        }
        table.tablesorters thead tr th {
            background-position: right center;
            background-repeat: no-repeat;
            color: #333333;
            cursor: pointer;
        }
        table.tablesorters tbody td {
            padding: 12px;
            vertical-align: middle;
        }
        table.tablesorters tbody td {
            border: 1px solid #D8E4E9;
            color: #6C7D8C;
            padding: 12px;
            vertical-align: top;
        }
        table.tablesorters thead tr th, table.tablesorter tfoot tr th {
            -moz-border-bottom-colors: none;
            -moz-border-left-colors: none;
            -moz-border-right-colors: none;
            -moz-border-top-colors: none;
            background: url("<?php echo $this->adminPath; ?>/img/tableshorter/titlebg.png") repeat-x scroll center bottom #EFF3F8;
            border-color: -moz-use-text-color #CBDAE8;
            border-image: none;
            border-left: 1px solid #CBDAE8;
            border-right: 1px solid #CBDAE8;
            border-style: none solid;
            border-width: medium 1px;
            font-size: 8pt;
            padding: 12px;
        }
        table.tablesorters tbody tr.odd {
            background-color: #FFFFFF;
        }
        table.tablesorters tbody tr:hover {
            background-color: #E4ECF3;
        }
        .newLoding{
            background: url("<?php echo $this->adminPath; ?>/img/loading/6.gif") no-repeat scroll center bottom #EFF3F8;
        }
        .page.selected a{
            background:#3E7CAC ;
            color:#FFFFFF;
        }
        .grid-view .button-column {
            text-align: center;
            width: 30px;
        }
    </style>

    <div class="content">
        <div class="albox succesbox" style="z-index: 770;">
            <span style="color: red;">当新增一个减DODO券操作时，DODO券的数量会减少</span><br>
        </div>
        <div style="z-index: 650;" class="st-form-line">
            <span class="st-labeltext">学生姓名</span>
            <span style="color: darkred"><?php echo $user_info->user_name; ?></span><br/><br/>
            <span class="st-labeltext">张数</span>
            <span style="color: darkred"><?php echo $count; ?></span><br/><br/>
            <a class="button-blue" href="javascript:history.go(-1);">返回</a>
            <div style="z-index: 640;" class="clear"></div>
        </div>

        <div style="z-index: 650;" class="st-form-line">
            <div class="shortcuts-icons"  style="float:right">
                <a class="icon-button" id="idd" href="javascript:void(0);"><img width="18" height="18" alt="icon" src="<?php echo $this->adminPath; ?>/img/icons/button/create.png"><span>添加DODO券操作</span></a>
            </div>
            <div style="z-index: 640;" class="clear"></div>
        </div>
        <div class="simplebox grid740" style="z-index: 500;">
            <div class="titleh" style="z-index: 490;">
                <h3>积分列表</h3>
            </div>
            <?php $this->widget('zii.widgets.grid.CGridView', array(
                'id'=>'wx-reply-grid',
                'template'=>"{items}{pager}",
                'ajaxUpdate'=>true,
                'loadingCssClass'=>'newLoding',
                'dataProvider'=>$dataProvider,
                'itemsCssClass'=>'tablesorters',
                'pagerCssClass'=>'pagination',
                'htmlOptions'=>array('style'=>'width:960px'),
                'pager'=>array(
                    'class'=>'CLinkPager',
                    'htmlOptions'=>array(
                        'class'=>'pagination',
                    ),
                    'nextPageLabel'=>'下一页',
                    'prevPageLabel'=>'上一页',
                    'lastPageLabel'=>'末页',
                    'header'=>'',
                ),
                'columns'=>array(
                    array(
                        'header'=>'积分细则',
                        'type'=>'raw',
                        'value' => '$data->g_title',
                    ),
                    array(
                        'header'=>'增/减',
                        'type'=>'raw',
                        'value' =>array($this,'duduJJ'),
                    ),
                    array(
                        'name' => '金额',
                        'type'=>'raw',
                        'value' => '$data->point',

                    ),
                    array(
                        'header'=>'时间',
                        'type'=>'raw',
                        'value' =>array($this,'isPointTime'),
                    ),

                ),

            ));
            ?>
        </div>
    </div>
<?php
//是否存在用户数据


Yii::app()->clientScript->registerScript('add',"
    $(function(){
        $('#idd').click(function(){
            art.dialog.open(
            '".Yii::app()->createAbsoluteUrl("admin/people/duduAdd",array('pid'=>$pid))."',
            {
                title:'新增dudu券操作',
                lock: true,
                width: 800,
                height: 600
            });
        })
    });

    function jifenInfo(id){
        window.location.href='".Yii::app()->createAbsoluteUrl("admin/people/pointInfo",array('role'=>1))."'+'&pid='+id;
    }


    function renderUpdate(token){
        art.dialog.open(
        '".Yii::app()->createAbsoluteUrl("admin/people/pointUpdate")."'+'id/'+token,
        {
            title:'修改',
            lock: true,
            width: 800,
            height: 600
        });
    }



    function renderDelete(token){
        if(confirm('本操作不可恢复，确定继续？')){
            $.ajax({
                type:'POST',
                url: '".Yii::app()->createAbsoluteUrl('admin/people/pointDelete')."'+'id/'+token,
                data:{},
                dataType:'json',
                beforeSend:function(){
                    art.dialog.Talert('正在删除数据ing', 5);
                },
                success:function(e){
                    if(e.status ==1){
                        art.dialog.Talert(e.message, 2);
                        window.location.reload();
                    }else{
                        art.dialog.Talert(e.message, 2);
                        return false;
                    }
                }
            });
        }
    }


    ",CClientScript::POS_END);

?>
